package com.berry.MedCheck;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.berry.MedCheck.db.DBOperatorTest;
import com.berry.MedCheck.db.MeasureDBTest;

/**
 * Created with IntelliJ IDEA.
 * User: Airay.Rong
 * Date: 13-12-5
 * Time: 下午2:53
 * To change this template use File | Settings | File Templates.
 */
public class TestActivity extends Activity {

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.test_activity);
		Button mBtn = (Button) findViewById(R.id.test_user_db);
		mBtn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				startActivity(new Intent().setClass(TestActivity.this, DBOperatorTest.class));
			}
		});

		mBtn = (Button) findViewById(R.id.test_measure_db);
		mBtn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				startActivity(new Intent().setClass(TestActivity.this, MeasureDBTest.class));
			}
		});

		mBtn = (Button) findViewById(R.id.test_get_data);
		mBtn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				sendAData();
			}
		});
	}

	private void sendAData() {
		Intent mi = new Intent();
		mi.putExtra(Utils.INTENT_PARA_USER_ID, 1);
		mi.putExtra(Utils.INTENT_PARA_DATE, System.currentTimeMillis());
		mi.putExtra(Utils.INTENT_PARA_SPO2, Math.random());
		mi.putExtra(Utils.INTENT_PARA_PR, Math.random());
		mi.putExtra(Utils.INTENT_PARA_PI, Math.random());
		mi.setAction(Utils.INTENT_ACK_UPDATE_DATA);
		mi.setClass(this, DataActivity.class);
		startActivity(mi);

	}
}